1. Field of the Invention
The present invention relates to an apparatus for analyzing a program and for displaying its result, more particularly to an apparatus and method for analyzing the program and categorizing a variable used in the program based on specific requirements.
2. Description of the Related Art
To understand the detailed processing of a program it is indispensable to analyze its variables, in particular to analyze information on its variables at the time of their declarative statements and the values held by the variables.
The conventional program analysis is limited to extracting the type and size of variables from a declarative statement on each data, and analyzing this only. For example, information on the type and size of each data as shown in FIG. 1B was obtained from the declarative statement on each data (variable) in the data declaration division of the COBOL program shown in FIG. 1A as the result of data type analysis.
By using the analysis result shown in FIG. 1B, for example, it can be judged that "ordered month", "ordered day", "delivered month" and "delivered day" are the same in both data type (numeric) and data size (2 digits). However, it cannot be judged from this analysis result whether or not each of the variable belongs to the same group.
For example, both "ordered day" and "delivered day" have the common restricting condition that the range of data value is "between 1 and 31". Namely, these data both belong to a domain "Day: Its range is between 1 and 31". On the other hand, for example, although "ordered day" and "ordered month" are the same in data type and data size, they are different in restricting condition. Namely, the restricting condition of an "ordered day" is "an integer between 1 and 31", while the restricting condition of an "ordered month" is "an integer between 1 and 12". Namely, each of the "ordered day" and "ordered month" belongs to a different domain.
In a wide sense, a domain means "a defined area" or "an area of certain knowledge or interest", and in a narrow sense, it means "an object characterized by a featured concept". For example, both "ordered date" and "delivered date" belong to a concept of "year/month/day", and in this case, "year/month/day" is a common domain for them. The "year/month/day" can be divided into "year", "month" and "day", and each of them corresponds to one domain.
A domain definition means a domain defined using a restricting condition (value range). For example, both "day" and "month" are defined as "an integer between 1 and 31" and "an integer between 1 and 12", respectively.
If this domain information (restricting condition of each variable, etc.) can be automatically extracted from an existing program, it will be very useful for the understanding, debugging, maintenance, improvement, etc of a program.
The applicant of the present invention has previously filed an application relating to an apparatus and method for extracting the relation between variables used in a program from the program, and categorizing them according to their domain (U.S. patent application Ser. No. 08/794,368). The invention is referred to hereinafter as the "Related invention".
The related invention discloses a technology for extracting a restricting condition given to each variable used in a program, and categorizing variables based on the restricting condition. For example, in the above example, the variable of which the restricting condition is defined as "an integer between 1 and 31" is extracted as a variable belonging to the domain of "day", the variable of which the restricting condition is defined as "an integer between 1 and 12" is extracted as a variable belonging to a domain of "month", and they are categorized by domain. The related invention also discloses a technology for categorizing variables by domain using an executable statement such as an assignment statement or comparison expression including variables. For example, when there is an executable statement of "MOVE var-a TO var-b", it is judged that both variable var-a and variable var-b belong to the same group.